import { fileURLToPath } from 'url'
import { createServer } from 'vite'
import path from 'path'

const __dirname = fileURLToPath(new URL('.', import.meta.url))

;(async () => {
  const server = await createServer({
    // 任何合法的用户配置选项，加上 `mode` 和 `configFile`
    configFile: path.resolve(__dirname, '../vite.config.js'),
    mode: "development",
    root: path.resolve(__dirname, '../'),
    server: {
      port: 1337,
      host: '0.0.0.0'
    },
  })
  await server.listen()

  server.printUrls()
})()